package com.zkthink.ceres.product.controller;

import com.zkthink.base.R;
import com.zkthink.ceres.product.dto.*;
import com.zkthink.ceres.product.service.ProductService;
import com.zkthink.ceres.product.vo.AdminProductPageVO;
import com.zkthink.ceres.product.vo.CategoryProductCombineVO;
import com.zkthink.ceres.product.vo.ProductGroupListVO;
import com.zkthink.ceres.product.vo.ProductPageVO;
import com.zkthink.log.annotation.SysLog;
import com.zkthink.security.annotation.PreAuth;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 前端控制器
 * 商品表
 * </p>
 *
 * @author JustArgo
 * @date 2020-05-03
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/platformProduct")
@Api(value = "PlatformProduct", tags = "平台商品接口")
//@PreAuth(replace = "product:")
public class PlatformProductController /*extends SuperController<ProductService, Long, Product, ProductPageDTO, ProductSaveDTO, ProductUpdateDTO>*/ {

    @Autowired
    private ProductService productService;

    @ApiOperation("平台查询商品列表")
    @PostMapping("/findAdminProductList")
    public R<AdminProductPageVO> findAdminProductList(@RequestBody AdminProductDTO dto) {
        return productService.findPlatformAdminProductList(dto);
    }

    @ApiOperation("查询类目商品或根据商品id列表查询商品")
    @PostMapping("findProductListByCategoryOrProductIdList")
    public R<CategoryProductCombineVO> findProductListByCategoryOrProductIdList(@RequestBody CategoryProductCombineDTO combineDTO){
        return productService.findProductListByCategoryOrProductIdList(combineDTO);
    }

}
